﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary
{
    /// <summary>
    /// This class represents a mathematical null matrix.
    /// </summary>
    [Serializable]
    public class NullMatrix : Matrix
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="NullMatrix"/> class.
        /// </summary>
        /// <param name="rows">The number of matrix rows.</param>
        /// <param name="columns">The number of matrix columns.</param>
        public NullMatrix(int rows, int columns)
            : base(rows, columns)
        {
        }

        /// <summary>
        /// Determines whether [the current matrix is a null matrix].
        /// </summary>
        /// <returns>
        /// 	<c>true</c> if [the current matrix is a null matrix]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsNullMatrix()
        {
            for (int i = 0; i < this.Rows; i++)
            {
                for (int j = 0; j < this.Columns; j++)
                {
                    if (this.GetValueAtPosition(new MatrixPosition(i, j)) != 0)
                    {
                        return false;
                    }
                }
            }

            return true;
        }
    }
}